package tech.konata.packetfix.mixins;

import de.florianmichael.viamcp.gui.GuiProtocolSelector;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;


@Mixin(GuiMultiplayer.class)
public class MixinGuiMultiplayer extends GuiScreen {

    @Inject(method = "createButtons", at = @At("RETURN"))
    private void createButtons(CallbackInfo ci) {
        this.buttonList.add(new GuiButton(69, 5, 5, 90, 20, "Version"));
    }

    @Inject(method = "actionPerformed", at = @At("HEAD"))
    private void actionPerformed(GuiButton button, CallbackInfo ci) {
        if (button.enabled && button.id == 69) {
            this.mc.displayGuiScreen(new GuiProtocolSelector(this));
        }
    }

}
